package com.zt.ztzx.controller;

import com.github.pagehelper.PageInfo;
import com.zt.ztzx.model.vo.DeviceVo;
import com.zt.ztzx.model.vo.common.Result;
import com.zt.ztzx.service.DeviceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("device")
public class DeviceController {

    @Autowired
    private DeviceService deviceService;

    //获取所有设备
    @GetMapping("/getDeviceList/{pageNum}/{pageSize}")
    @Operation(summary = "设备列表", description = "设备列表",method = "getDeviceList方法")
    @Parameters({
            @Parameter(name = "tid",description = "类型ID",required = true),
            @Parameter(name = "pageNum",description = "当前页码",required = true),
            @Parameter(name = "pageSize",description = "每页显示条数",required = true)
    })
    public Result<PageInfo<DeviceVo>> getDeviceList(Integer tid, @PathVariable("pageNum")Integer pageNum, @PathVariable("pageSize")Integer pageSize){
        return deviceService.getDeviceList(tid,pageNum, pageSize);
    }
}
